<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/index.css"/>
		<link rel="stylesheet" type="text/css" href="csstitle/title.css"/>
	</head>
	<script type="text/javascript" src="js/jquery-2.1.0.js"></script>
	<script type="text/javascript">
		
		function showSysAndAllMessage(){
			var sic = $("#sys_info_count");
			var mic = $("#my_info_count");
		　　$.ajax({
			type:"post",
			url:"getNotRead",
			dataType:"text",
			success:function(d){
				sic.text(d.split("-")[0]);
				mic.text(d.split("-")[1]);
				if(d.split("-")[0] == 0){
					sic.hide(0);
				}else if(d.split("-")[0] >99){
					sic.text("99");
				}
				if(d.split("-")[1] == 0){
					mic.hide(0);
				}else if(d.split("-")[1] >99){
					mic.text("99");
				}
			},
		});

		}
	
	
		$(function(){
			var sic = $("#sys_info_count");
			var mic = $("#my_info_count");
			var t = setInterval("showSysAndAllMessage()",3000);
			/*
			$.ajax({
				type:"post",
				url:"getNotRead",
				dataType:"text",
				success:function(d){
					console.log(d);
					sic.text(d.split("-")[0]);
					mic.text(d.split("-")[1]);
					console.log(d.split("-")[1]);
					if(d.split("-")[0] == 0){
						sic.hide(0);
					}else if(d.split("-")[0] >99){
						sic.text("99");
					}
					if(d.split("-")[1] == 0){
						mic.hide(0);
					}else if(d.split("-")[1] >99){
						mic.text("99");
					}
				},
				error:function(d){
					console.log(d);
				}
			});
			*/
			$("body").on("click","#sys_info",function(){
				$("#chat").empty();
				$("#chat").append("<iframe src=\"official notification.html\" width=\"98%\" height=\"98%\" scrolling=\"no\" frameborder=\"0\"></iframe>");
				
				$.ajax({
					type:"post",
					url:"setSysRead",
					success:function(d){
						sic.text(d);
						console.log(d);
						if(d.split("-")[0] == 0){
							sic.hide(0);
						}
					}
				});
			});
			$("body").on("click","#my_info",function(){
				$("#chat").empty();
				$("#chat").append("<iframe src=\"chat.html\" width=\"98%\" height=\"98%\" scrolling=\"no\" frameborder=\"0\"></iframe>");
				mic.hide(0);
			});
		});
	</script>
	<body>
		<div id="container">
			<div id="nev">
				<div id="title">
					<section class="c1">
			            <nav class="cl">
				        <a href="main.html"  target="_self" data-hover="主页"><span>主页</span></a>
				        <a href="login.html"  target="_self" data-hover="美食收录"><span>美食收录</span></a>
				        <a href="login.html"  target="_self" data-hover="交流圈子"><span>交流圈子</span></a>
				        <a href="login.html"  target="_self" data-hover="个人主页"><span>个人主页</span></a>
			            </nav>
	           		 </section>	
				</div>
			</div>
			<div id="bg">
				<div id="mengban">
					<div id="tips">
						<div id="msg_center">
							<div id="msg_center_icon">
								
							</div>
							<div id="msg_center_font">
								消息中心
							</div>
						</div>
						<div id="tips_bottom">
							<ul id= "tips_ul">
								<li class ="tips_ul_li"><a href="#" id = "sys_info">系统通知</a></li>
								<li class ="tips_ul_li"><a href="#" id = "my_info">我的消息</a></li>
							</ul>
							<div id="sys_info_count">
							</div>
							<div id="my_info_count">
								
							</div>
						</div>
					</div>
					<div id="chat">
						
					</div>
				</div>
			</div>
		</div>
		
	</body>
</html>
